import BaseNode from '@/components/logic-editor/nodes/Base/base'
import { NODE_TYPE } from '@/components/logic-editor/constant'

class RequestNodeView extends BaseNode.view {}

class RequestNodeModel extends BaseNode.model {
  getNodeName() {
    return this.properties.name
  }

  getNodeClassName() {
    return NODE_TYPE.REQUEST
  }

  getNodeAbstract() {
    const title = '数据请求'
    const content = []
    if (this.properties && this.properties.ds) {
      content.push({
        desc: this.properties.ds.name,
        type: 'request',
      })
    }
    return {
      title,
      content,
      showButton: true,
    }
  }
}

export default {
  type: 'request',
  view: RequestNodeView,
  model: RequestNodeModel,
}
